package com.blackfish.path;

import java.util.List;

import com.blackfish.common.model.PathConfig;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;;

public class PathService {
	private static final PathConfig dao = new PathConfig().dao();
	
	public String getNameById(int id){
			return this.findById(id).getPath();	 //获取的是路径，getDB是获得某个数据库名称
	}
	
	public PathConfig findById(int id) {
		return dao.findById(id);
	}
	
	public void deleteById(int id) {
		dao.deleteById(id);
	}
	
	public List<PathConfig> findAll(){
		 return dao.find("select * from path order by id asc");
	}
	
	public int savePathGetId(String path){
		PathConfig pathconf = new PathConfig().set("path",path);
		pathconf.save();
		return pathconf.getId();
	}

	public List<Record> findAllView(){
		return Db.find("select * from path_config");
	}
}
